from datetime import datetime
from typing import Optional
from pydantic import BaseModel


class UserInfo(BaseModel):
    """用户信息"""
    id: int
    nickname: Optional[str] = None
    avatar_url: Optional[str] = None
    created_at: Optional[datetime] = None

    class Config:
        from_attributes = True


class WechatLoginResponse(BaseModel):
    """登录响应"""
    code: int
    message: str
    data: dict


class UserInfoRequest(BaseModel):
    nickname: str
    avatar_url: str


class UserUpdateRequest(BaseModel):
    """更新用户信息请求"""
    nickname: Optional[str] = None


class UserResponse(BaseModel):
    id: int
    nickname: Optional[str] = None
    avatar_url: Optional[str] = None
    created_at: datetime

    class Config:
        from_attributes = True 